<link type="text/css" href="/admins/js/jquery/css/ui-lightness/jquery-ui-1.8.20.custom.css" rel="stylesheet" >
<script type="text/javascript" src="/admins/js/My97DatePicker/WdatePicker.js"></script>
<link href="/js/boxy/css/boxy.css" media="screen" rel="stylesheet" type="text/css" >
<link href="/admins/css/yundan.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="/js/boxy/js/jquery.boxy.js"></script>
<script type="text/javascript" src="/admins/js/My97DatePicker/WdatePicker.js"></script>
<link type="text/css" href="/admins/js/jquery/css/ui-lightness/jquery-ui-1.8.20.custom.css" rel="stylesheet" />
<div class="admin_nrtop">
      <div class="ad_search">
            <form action=""  method="get" style="margin:0px" id="form1" name="form1">
                  <input type="hidden" id="pagesize" name="pagesize" value=""/>
                  <input type="hidden" id="starttime" name="starttime" value="<?php echo $this->starttime ? $this->starttime : ""; ?>"/>
                  <input type="hidden" id="endtime" name="endtime" value="<?php echo $this->endtime ? $this->endtime : ""; ?>" />
                  <div class="timebox">
                        <div class="ad_time" style="width:320px;">
                              <div class="timefw">
                                    <div class="time">
                                          <!--点击后悬停样式为：<div class="timeselect t_on">-->
                                          <div class="timeselect"  id="stime">
                                                <span id="stimeval"><?php echo $this->starttime ? $this->starttime : date("Y-m-d", mktime(0, 0, 0, date("m"), date("d") - 30, date("Y"))); ?></span><i></i>
                                          </div>
                                          <div class="timeslelctbox">
                                                <!---时间插件放此DIV-->
                                          </div>
                                    </div>
                                    <div class="timezhi">
                                          <span>至</span>
                                    </div>
                                    <div class="time" >
                                          <div class="timeselect" id="etime">
                                                <span id="etimeval"><?php echo $this->endtime ? $this->endtime : date("Y-m-d"); ?></span><i></i>
                                          </div>
                                          <div class="timeslelctbox">
                                                <!---时间插件放此DIV-->
                                          </div>
                                    </div>
                              </div>
                        </div>
                        <div class="timeok">
                              <a id="hrefsubmit" style="cursor:pointer;">确定</a>
                        </div>
                  </div>
            </form>
            <h3 style="font-size:22px;font-weight:normal;">代购数据</h3>
      </div>
</div>
<div  class="biaoge">
      <div class="biaotbody">
            <table >
                  <tr>
                        <th class="li10" style="text-align:center">
                              付款时间
                        </th>
                        <th class="li10" >
                              代购订单号
                        </th>
                        <th class="li10" >
                              淘宝订单号
                        </th>
                        <th class="li10" >
                              运费
                        </th>
                        <th class="li10" >
                              预付款
                        </th>
                        <th class="li8" >
                              购买账号
                        </th>
                        <th class="li8" >
                              状态
                        </th>
                        <th class="li8" >
                              退款金额
                        </th>
                  </tr>
            </table>
      </div>
      <div class="table" style='margin-top:0px;'>
            <table>
                  <?php
                  if ($this->resultlist) {
                        $sum = 0;
                        $wsum = 0;
                        foreach ($this->resultlist as $key => $Item) {
                              ?>
                              <tr>
                                    <td class="li10" align="center"><?php echo $Item->datePaid ?></td>
                                    <td class="li10" >
                                          <div class="yubm">
                                                <?php echo $Item->id; ?>
                                                </a></div>
                                    </td>
                                    <td class="li10" >
                                          <?php echo $Item->procureNo; ?>
                                    </td>
                                    <td class="li10" >
                                          <?php echo $Item->shipFee; ?>
                                    </td>
                                    <td class="li10" >
                                          <?php echo $Item->productTotal; ?>
                                    </td>
                                    <td class="li8" >
                                          <?php echo $Item->BuyidNoname; ?>
                                    </td>
                                    <td class="li8" >
                                          <?php echo $Item->StatusName; ?>
                                    </td>
                                    <td class="li8" >
                                          <?php echo $Item->moneygroup; ?>
                                    </td>
                              </tr>

                              <?php }
                        ?>

                  <?php
                  } else {
                        echo '<div class="tablebox"></div>';
                  }
                  ?>


            </table>
      </div>
</div>
<div class="toolbar">
<?php echo $this->partial('paging.phtml', array("pages" => $this->resultAll, "pamas" => "quick=" . $this->status . "&starttime=$this->starttime&endtime=$this->endtime")); ?>
</div>
<table>    
      <tfoot>
            <tr>
                  <td colspan="2">　
                        &nbsp;&nbsp;&nbsp;<button class="button" id="csv-button" style="background-color: #1668A4;width: 80px;height: 30px;color: white;font-size: 14px;border-radius:8px;">导出csv</button>
                  </td></tr>
      </tfoot>    
</table>
<script type="text/javascript">
      $(document).ready(function() {
            $('#csv-button').attr({target: "_blank"});
            var option = $("#style").val();
//            alert(option);
            $("#quick option[value =" + option + " ]").attr("selected", "true");
            $(".timezdy").click(function() {
                  $(".timezdy .timeselect2").attr("class", "timeselect2 timeon");
                  $(".timeslelct_xl").show();
            });
            $(".timezdy").mouseleave(function() {
                  $(".timeselect2").attr("class", "timeselect2");
                  $(".timeslelct_xl").hide();
            });
            $("#stime").click(function() {
                  $(this).attr("class", "timeselect t_on");
                  WdatePicker({el: 'stimeval', vel: 'starttime', onpicked: function() {
                              $("#stime,#etime").attr("class", "timeselect");
                        }});
            });
            $("#etime").click(function() {
                  $(this).attr("class", "timeselect t_on");
                  WdatePicker({el: 'etimeval', vel: 'endtime', onpicked: function() {
                              $("#stime,#etime").attr("class", "timeselect");
                        }});
            });
            $("#hrefsubmit").click(function() {
                  var stime = new Date($("#starttime").val());
                  var etime = new Date($("#endtime").val());
                  var time = (etime - stime) / 86400000;
                  if (time >= 35) {
                        alert("数据量过大，请重置时间（不大于35天）");
                  } else {
                        $("#form1").submit();
                  }
            });
            $('#csv-button').click(function() {
                  if (confirm("确定要导出！")) {
                        $("#form1").attr("action", "/admini/managedata/dumporderdata");
                        var stime = new Date($("#starttime").val());
                        var etime = new Date($("#endtime").val());
                        var time = (etime - stime) / 86400000;
                        if (time >= 15) {
                              alert("数据量过大，请重置时间（不大于15天）");
                        } else {
                              $("#form1").submit();
                        }
                        $('#export').val("");
                  }
                  //location.reload();
            });
      });
</script>
